Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
¿Cómo convierto struct System.Byte byte[] en un objeto System.IO.Stream en C#?

¿Cómo convierto struct System.Byte byte[] en un objeto System.IO.Stream en C# ?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

La forma más fácil de convertir una matriz de bytes en un flujo es usando la clase MemoryStream :

 Stream stream = new MemoryStream(byteArray);
over 4 years ago · Santiago Trujillo Report

0

Está buscando el método MemoryStream.Write .

Por ejemplo, el siguiente código escribirá el contenido de una matriz byte[] en un flujo de memoria:

 byte[] myByteArray = new byte[10]; MemoryStream stream = new MemoryStream(); stream.Write(myByteArray, 0, myByteArray.Length);

Alternativamente, podría crear un nuevo objeto MemoryStream de tamaño no variable basado en la matriz de bytes:

 byte[] myByteArray = new byte[10]; MemoryStream stream = new MemoryStream(myByteArray);
over 4 years ago · Santiago Trujillo Report

0

El enfoque general para escribir en cualquier flujo (no solo MemoryStream ) es usar BinaryWriter :

 static void Write(Stream s, Byte[] bytes) { using (var writer = new BinaryWriter(s)) { writer.Write(bytes); } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!